export class TimeTools {
    /**
     * 获取日期
     * @returns yyyyMMdd格式 
     */
    public static GetDate() {
        let date = new Date();
        return date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();
    }

    /**获取计时器 */
    public static GetTimer(seconds: number) {
        let hours = Math.floor(seconds / 3600);
        let minutes = Math.floor((seconds - hours * 3600) / 60);
        let remainingSeconds = Math.floor(seconds - hours * 3600 - minutes * 60);

        let h = hours < 10 ? `0${hours}` : `${hours}`;
        let m = minutes < 10 ? `0${minutes}` : `${minutes}`;
        let s = remainingSeconds < 10 ? `0${remainingSeconds}` : `${remainingSeconds}`;

        return `${h}:${m}:${s}`;
    }
}

